# {"model": "llama3", "prompt": "上句说的什么？", "context": context}

content=$(curl http://localhost:11434/api/generate -d '{
  "stream": false,
   "model": "qwen3:0.6b",
  "prompt": "Why is the sky blue?"
}'| jq .context)

content=$(curl http://localhost:11434/api/generate -d '{
  "stream": true,
   "model": "qwen3:0.6b",
  "prompt": "Why is the sky blue?"
}'| jq .context)


curl http://localhost:11434/v1/chat/completions -d '{
  "model": "qwen3:0.6b",
  "tools": [
    {
      "function": {
        "name": "execute_sql",
        "description": "\u6267\u884cSQL\u67e5\u8be2\u8bed\u53e5\n\n\u53c2\u6570:\n    query (str): \u8981\u6267\u884c\u7684SQL\u8bed\u53e5\uff0c\u652f\u6301\u591a\u6761\u8bed\u53e5\u4ee5\u5206\u53f7\u5206\u9694\n\n\u8fd4\u56de:\n    list[TextContent]: \u5305\u542b\u67e5\u8be2\u7ed3\u679c\u7684TextContent\u5217\u8868\n    - \u5bf9\u4e8eSELECT\u67e5\u8be2\uff1a\u8fd4\u56deCSV\u683c\u5f0f\u7684\u7ed3\u679c\uff0c\u5305\u542b\u5217\u540d\u548c\u6570\u636e\n    - \u5bf9\u4e8eSHOW TABLES\uff1a\u8fd4\u56de\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u8868\u540d\n    - \u5bf9\u4e8e\u5176\u4ed6\u67e5\u8be2\uff1a\u8fd4\u56de\u6267\u884c\u72b6\u6001\u548c\u5f71\u54cd\u884c\u6570\n    - \u591a\u6761\u8bed\u53e5\u7684\u7ed3\u679c\u4ee5\"---\"\u5206\u9694\n\n\u5f02\u5e38:\n    Error: \u5f53\u6570\u636e\u5e93\u8fde\u63a5\u6216\u67e5\u8be2\u6267\u884c\u5931\u8d25\u65f6\u629b\u51fa\n",
        "parameters": {
          "properties": {
            "query": {
              "title": "Query",
              "type": "string"
            }
          },
          "required": [
            "query"
          ],
          "type": "object"
        }
      },
      "type": "function"
    },
    {
      "function": {
        "name": "list_databases",
        "description": "\n\u5217\u51fa\u6240\u6709\u6570\u636e\u5e93\n\n\u8fd4\u56de:\n    list[TextContent]: \u5305\u542b\u67e5\u8be2\u7ed3\u679c\u7684TextContent\u5217\u8868\n    - \u8fd4\u56de\u5339\u914d\u7684\u8868\u540d\u3001\u6570\u636e\u5e93\u540d\u548c\u8868\u6ce8\u91ca\u4fe1\u606f\n    - \u7ed3\u679c\u4ee5CSV\u683c\u5f0f\u8fd4\u56de\uff0c\u5305\u542b\u5217\u540d\u548c\u6570\u636e\n",
        "parameters": {
          "properties": {},
          "type": "object"
        }
      },
      "type": "function"
    },
    {
      "function": {
        "name": "get_table_name",
        "description": "\u6839\u636e\u8868\u7684\u4e2d\u6587\u6ce8\u91ca\u641c\u7d22\u6570\u636e\u5e93\u4e2d\u7684\u8868\u540d\n\n\u53c2\u6570:\n    text (str): \u8981\u641c\u7d22\u7684\u8868\u4e2d\u6587\u6ce8\u91ca\u5173\u952e\u8bcd\n\n\u8fd4\u56de:\n    list[TextContent]: \u5305\u542b\u67e5\u8be2\u7ed3\u679c\u7684TextContent\u5217\u8868\n    - \u8fd4\u56de\u5339\u914d\u7684\u8868\u540d\u3001\u6570\u636e\u5e93\u540d\u548c\u8868\u6ce8\u91ca\u4fe1\u606f\n    - \u7ed3\u679c\u4ee5CSV\u683c\u5f0f\u8fd4\u56de\uff0c\u5305\u542b\u5217\u540d\u548c\u6570\u636e\n",
        "parameters": {
          "properties": {
            "text": {
              "title": "Text",
              "type": "string"
            }
          },
          "required": [
            "text"
          ],
          "type": "object"
        }
      },
      "type": "function"
    },
    {
      "function": {
        "name": "get_table_desc",
        "description": "\u83b7\u53d6\u6307\u5b9a\u8868\u7684\u5b57\u6bb5\u7ed3\u6784\u4fe1\u606f\n\n\u53c2\u6570:\n    text (str): \u8981\u67e5\u8be2\u7684\u8868\u540d\uff0c\u591a\u4e2a\u8868\u540d\u4ee5\u9017\u53f7\u5206\u9694\n\n\u8fd4\u56de:\n    list[TextContent]: \u5305\u542b\u67e5\u8be2\u7ed3\u679c\u7684TextContent\u5217\u8868\n    - \u8fd4\u56de\u8868\u7684\u5b57\u6bb5\u540d\u3001\u5b57\u6bb5\u6ce8\u91ca\u7b49\u4fe1\u606f\n    - \u7ed3\u679c\u6309\u8868\u540d\u548c\u5b57\u6bb5\u987a\u5e8f\u6392\u5e8f\n    - \u7ed3\u679c\u4ee5CSV\u683c\u5f0f\u8fd4\u56de\uff0c\u5305\u542b\u5217\u540d\u548c\u6570\u636e\n",
        "parameters": {
          "properties": {
            "text": {
              "title": "Text",
              "type": "string"
            }
          },
          "required": [
            "text"
          ],
          "type": "object"
        }
      },
      "type": "function"
    },
    {
      "function": {
        "name": "get_lock_tables",
        "description": "",
        "parameters": {
          "properties": {},
          "type": "object"
        }
      },
      "type": "function"
    }
  ],
  "messages": [
    {
      "role": "system",
      "content": "You are a assistant with ability to use tool with function call and summary result for question."
    },
    {
      "role": "user",
      "content": "列出mysql所有的database，并找出跟股票信息相关的表，列出表结构?"
    }
  ],
  "stream": true
}' -H "Content-Type: application/json" -N